home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Testing & Debugging / Virtual User tools / VU Assist Modules for MacApp / Assist Module MA 2.0.1 / VUAssist Source Code / UVUAssist.p < prev   
Encoding:
Text File  |  1993-09-17  |  7.2 KB  |  238 lines  |  [TEXT/MPS ]

  1. (*+
  2.  *    File:        UVUAssist.p
  3.  *
  4.  *    Contains:    VU Assistance class
  5.  *
  6.  *    Written by:    David Shayer
  7.  *
  8.  *    Copyright:    © 1991 by Apple Computer, Inc., all rights reserved.
  9.  *
  10.  *  Version: 1.0d10
  11.  *
  12.  *         8/29/91    JAS      add prototype for MyWMgrToWindow, bump version to 1.0d10
  13.  *         8/21/91    JAS      change version
  14.  *         8/19/91    JAS      eliminate comments which are already in READ ME FIRST! file
  15.  *         8/19/91    JAS      rev comments and change case of GridItemSupport to 
  16.  *                          gridItemSupport
  17.  *         8/15/91    JAS      add fGridItemSupport data member to TVUAssist and change
  18.  *                          prototype of IVUAssist to take GridItemSupport as input
  19.  *         8/13/91    JAS      include gridItem parameter in FillDlogItemDesc and RankToItem 
  20.  *         8/13/91    JAS      make TGridItem direct descendant of TObject instead of 
  21.  *                          TGridView
  22.  *         8/6/91        JAS      remove TVUAssist.DoFindWindowInfo (not needed) 
  23. -*)
  24.  
  25.  
  26. {Historical Note:  References to the "Mole" are equivalent to references to "Agent VU".
  27. "Agent VU" was previously called the "Mole".}
  28.  
  29. (*
  30.  
  31. So you wanna use V.U. to test your MacApp program?  You need to help Agent VU find things
  32. in your windows, since MacApp views appear empty to Agent VU.  Fortunately, Agent VU has a 
  33. hook for an assistance procedure.  The assistance procedure is a routine, in the application
  34. being manipulated by V.U., that feeds Agent VU inside information about what's in the
  35. views.  This unit implements that assistance routine.
  36.  
  37. This unit contains 4 files: VUAssist.p, VUAssist.inc1.p, VUAssist.inc2.p,
  38. and VUAssist.a.
  39.  
  40. See the "READ ME FIRST!" file for instructions on how to use VUAssist and other information.
  41.  
  42. *)
  43.  
  44.  
  45. UNIT UVUAssist;
  46.  
  47.     INTERFACE
  48.  
  49.         USES
  50.         
  51.             { • MacApp }
  52.             UMacApp,
  53.             {$IFC qDebug}
  54.                 UDebug,
  55.             {$ENDC}
  56.     
  57.             { • Building Blocks }
  58.             UPrinting, UTEView, UDialog, UGridView,
  59.  
  60.             { • System Interfaces }
  61.             Errors,
  62.             Resources,
  63.             AppleTalk, ToolUtils,
  64.             OSEvents,
  65.             Packages,
  66.             Script,
  67.             Desk;
  68.     
  69.         {$I UVUAssist.inc1.p}
  70.  
  71.         TYPE
  72.  
  73.             { There is a another definition of this object in UVUAssist.a, which is
  74.             a subset of this definition. If you update this definition, be sure to 
  75.             update the one in UVUAssist.a, if necessary. }
  76.             TVUAssist = OBJECT (TEvtHandler)
  77.                 
  78.                 fMoleRefNum :integer;
  79.                 
  80.                 fGridItemSupport :boolean;
  81.         
  82.                 PROCEDURE TVUAssist.IVUAssist(gridItemSupport: boolean);
  83.         
  84.                 PROCEDURE TVUAssist.OpenMoleDriver;
  85.         
  86.                 PROCEDURE TVUAssist.SuspendMole;
  87.         
  88.                 PROCEDURE TVUAssist.ResumeMole; 
  89.         
  90.                 PROCEDURE TVUAssist.SetDebuggerHook (NewHook :ProcPtr); 
  91.         
  92.                 FUNCTION TVUAssist.MoleAssist (Select :integer; Input :Ptr; Output :Ptr; 
  93.                     VAR OutputSize :integer; IntResult :integer) :integer; 
  94.                 
  95.                 FUNCTION TVUAssist.DoMenuInfo (Input :Ptr; Output :Ptr; VAR OutputSize :integer; 
  96.                     Result :MoleError) :MoleError;
  97.         
  98.                 FUNCTION TVUAssist.DoMenuItems (Input :Ptr; Output :Ptr; VAR OutputSize :integer; 
  99.                     Result :MoleError) :MoleError;
  100.         
  101.                 FUNCTION TVUAssist.DoSendWindowInfo (Input :Ptr; Output :Ptr; 
  102.                     VAR OutputSize :integer; Result :MoleError) :MoleError;
  103.         
  104.                 FUNCTION TVUAssist.DoFindControl (Input :Ptr; Output :Ptr; 
  105.                     VAR OutputSize :integer; Result :MoleError) :MoleError;
  106.         
  107.                 FUNCTION TVUAssist.DoSendControlInfo (Input :Ptr; Output :Ptr; 
  108.                     VAR OutputSize :integer; Result :MoleError) :MoleError;
  109.         
  110.                 FUNCTION TVUAssist.DoSendDlogItemInfo (Input :Ptr; Output :Ptr; 
  111.                     VAR OutputSize :integer; Result :MoleError) :MoleError;
  112.         
  113.                 PROCEDURE TVUAssist.FillPopupDesc (Popup: TPopup; MenuRank: integer; 
  114.                     MenuDescPtr :MoleMenuInfoPtr; VAR OutputSize :integer);
  115.         
  116.                 FUNCTION TVUAssist.FillPopupItemDesc (Popup: TPopup; MenuRank: integer; 
  117.                     start: integer; stop: integer; MenuItemDescPtr :MoleDataBlockPtr; 
  118.                     VAR OutputSize :integer) :MoleError;
  119.         
  120.                 FUNCTION TVUAssist.FillCtrlDesc (CtrlDescPtr :MoleCDescPtr; thePart :integer; 
  121.                     WindRank :integer; ControlRank :integer; Control :TControl; 
  122.                     VAR OutputSize :integer): Boolean;
  123.         
  124.                 PROCEDURE TVUAssist.ViewRectToWindowRect (VAR aRect :Rect; aView :TView);
  125.         
  126.                 PROCEDURE TVUAssist.FillDlogItemDesc (DlogDescPtr :MoleDItemInfoPtr; 
  127.                     Window :TWindow; WindRank :integer; ItemRank :integer; Item :TView; 
  128.                     VAR OutputSize :integer; gridItem :TGridItem );
  129.         
  130.                 FUNCTION TVUAssist.MyWMgrToWindow(wMgrWindow: WindowPtr) :TWindow;
  131.  
  132.                 FUNCTION TVUAssist.RankToWindow (Rank :integer) :TWindow;
  133.                 
  134.                 FUNCTION TVUAssist.WindowToRank (WindToFind :WindowPeek) :integer;
  135.         
  136.                 PROCEDURE TVUAssist.GlobalToWindow (Window :TWindow; Pt :Point; VAR VPt :VPoint);
  137.         
  138.                 PROCEDURE TVUAssist.WindowToView (View :TView; VAR VPt :VPoint; VAR Pt :Point);
  139.         
  140.                 FUNCTION TVUAssist.MenuIDToPopup (MenuID :integer) :TPopup;
  141.         
  142.                 FUNCTION TVUAssist.PointToControl (Window :TWindow; Pt :Point; 
  143.                     VAR Rank :integer) :TCtlMgr;
  144.         
  145.                 FUNCTION TVUAssist.ItemToRank (Window :TWindow; View :TView; 
  146.                     DlogViewItems :Boolean) :integer;
  147.         
  148.                 FUNCTION TVUAssist.RankToItem (Window :TWindow; Rank :integer; 
  149.                     DlogViewItems :Boolean; VAR gridItem: TGridItem ) :TView;
  150.         
  151.                 FUNCTION TVUAssist.ViewCount (Window :TWindow; DlogViewItems :Boolean) :integer;
  152.         
  153.                 FUNCTION TVUAssist.CountGridItems (theGridView: TGridView): integer;
  154.         
  155.                 FUNCTION TVUAssist.GetItemType (Item :TView; DlogViewItems :Boolean;
  156.                     GridViewItems: Boolean) :ViewItems;
  157.         
  158.                 {$IFC qDebug}
  159.                     
  160.                     PROCEDURE TVUAssist.PrintFindWindReq (WindReqPtr :SendFindWindowParamPtr);
  161.             
  162.                     PROCEDURE TVUAssist.PrintWindReq (WindReqPtr :DWindReqPtr);
  163.             
  164.                     PROCEDURE TVUAssist.PrintWindDesc (WindDescPtr :MoleWDescPtr);
  165.             
  166.                     PROCEDURE TVUAssist.PrintCtrlReq (CtrlReqPtr :SendCtlInfoParamsPtr);
  167.             
  168.                     PROCEDURE TVUAssist.PrintCtrlPoint (CtrlReqPtr :SendFindControlParamPtr);
  169.             
  170.                     PROCEDURE TVUAssist.PrintCtrlDesc (CtrlDescPtr :MoleCDescPtr);
  171.             
  172.                     PROCEDURE TVUAssist.PrintDlogReq (DlogReqPtr :SendDItemInfoPtr);
  173.             
  174.                     PROCEDURE TVUAssist.PrintDlogDesc (DlogDescPtr :MoleDItemInfoPtr);
  175.             
  176.                     PROCEDURE TVUAssist.PrintMenuInfoReq (MenuReqPtr :SendMenuInfoParamsPtr);
  177.             
  178.                     PROCEDURE TVUAssist.PrintMenuInfoDesc (MenuDescPtr :MoleMenuInfoPtr);
  179.             
  180.                     PROCEDURE TVUAssist.PrintMenuItemReq (MenuReqPtr :SendMenuItemsParamsPtr);
  181.             
  182.                     PROCEDURE TVUAssist.PrintMenuItemDesc (MenuDescPtr :MoleDataBlockPtr; 
  183.                         OutputSize :integer);
  184.             
  185.                     PROCEDURE TVUAssist.Fields(PROCEDURE DoToField(fieldName: Str255; 
  186.                         fieldAddr: Ptr; fieldType: INTEGER)); OVERRIDE;
  187.                         
  188.                 {$ENDC}
  189.             
  190.             END;
  191.  
  192.     
  193.             TGridItem = OBJECT (TObject)
  194.                 
  195.                 fGridView:    TGridView;        { reference to a TGridView object}
  196.                 
  197.                 fColumn:    longint;        { 1 based counter }
  198.                 
  199.                 fRow:        longint;        { 1 based counter }
  200.                 
  201.                 fRank:        longint;        { (row-1) * rowlength + column }
  202.                 
  203.                 PROCEDURE TGridItem.IGridItem(theGridView: TGridView; Rank: integer);
  204.  
  205.                 PROCEDURE TGridItem.GetExtent(VAR itsExtent: VRect); 
  206.         
  207.                 PROCEDURE TGridItem.LocalToWindow(VAR thePoint: VPoint); 
  208.                 
  209.                 {$IFC qDebug}
  210.                 
  211.                     PROCEDURE TGridItem.PrintInstanceVars;
  212.         
  213.                     PROCEDURE TGridItem.Fields(PROCEDURE DoToField(fieldName: Str255; 
  214.                         fieldAddr: Ptr; fieldType: INTEGER)); OVERRIDE;
  215.                 {$ENDC}
  216.             
  217.                 END;
  218.  
  219.     
  220.         
  221.         VAR
  222.             gVUAssist :                    TVUAssist;        { the mole assist proc }
  223.             
  224.             {$IFC qDebug}
  225.                 
  226.                 gVUDebug :                Boolean;        { debug mode is on }
  227.             
  228.             {$ENDC}
  229.  
  230.  
  231.     
  232.     IMPLEMENTATION
  233.  
  234.         {$I UVUAssist.inc2.p}
  235.  
  236.  
  237. END.
  238.